package task;

import MemoryDB.YuanRow;

public class TaskWasDone {
    public static MainTaskReward GetTaskReward(YuanRow rows, MainTaskReward reward, String str)
    {
        reward = new MainTaskReward();
        reward.itemId = rows.getItem(str).getYuanColumnText();
        reward.exp = GetIntDBAsName("RewardExp", 0, rows);
        reward.gold = GetIntDBAsName("RewardGold", 0, rows);
        reward.rank = GetIntDBAsName("RewardBloodStone", 0, rows);
        reward.taskDescription = rows.getItem("TaskInfo").getYuanColumnText();
        reward.rewardType = GetIntDBAsName("RewardExpType", 0,rows);
        return reward;
    }

   public static int GetIntDBAsName(String name, int ret, YuanRow rows)
    {
        int i = 0;
        try
        {
            i = Integer.parseInt(rows.getItem(name).getYuanColumnText());
            return i;
        }
        catch (Exception e)
        {
            return ret;
        }
    }
}
